<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    
</body>
<script>
    // 自定义函数定义
    // 1.普通函数定义 function 函数名（参数）{函数体}
    // 2.函数赋值给变量，通过变量调用函数
    // 3.匿名函数
    function sayHello(userName){
        alert("Hello" + userName);
    }
    sayHello("zhangsan");

    //匿名函数
    var showAge = function(age){
        // return "年龄为" + age;
        var str = "年龄为" + age;
    }
    console.log(showAge(20));
</script>
</html>